package ar.edu.utn.frsf.proyectofinal.sistemadecontrolmodbus.persistence.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


@Entity
@Table(name="ALARM")
public class Alarm {

	@Id
	@Column(name="id")
	@SequenceGenerator(name = "SecuenciaAlarma", sequenceName = "seq_alarm", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SecuenciaAlarma")
	private Integer ID;
	
	@Column(name="name")
	private String name;
	
	@Column(name="operator")
	private Operator operator;
	
	@Column(name="threshold")
	private Integer threshold;
	
	@ManyToOne
	@JoinColumn(name="field")
	private Field field;
	
	@ManyToOne
	@JoinColumn(name="deviceType")
	private DeviceType deviceType;
	
	public enum Operator {EQUAL, NOT_EQUAL, MINOR, MINOR_EQUAL, MAYOR, MAYOR_EQUAL}

	/**
	 * @return the iD
	 */
	public Integer getID() {
		return ID;
	}

	/**
	 * @param iD the iD to set
	 */
	public void setID(Integer iD) {
		ID = iD;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the operator
	 */
	public Operator getOperator() {
		return operator;
	}

	/**
	 * @param operator the operator to set
	 */
	public void setOperator(Operator operator) {
		this.operator = operator;
	}

	/**
	 * @return the threshold
	 */
	public Integer getThreshold() {
		return threshold;
	}

	/**
	 * @param threshold the threshold to set
	 */
	public void setThreshold(Integer threshold) {
		this.threshold = threshold;
	}

	/**
	 * @return the field
	 */
	public Field getField() {
		return field;
	}

	/**
	 * @param field the field to set
	 */
	public void setField(Field field) {
		this.field = field;
	}

	/**
	 * @return the deviceType
	 */
	public DeviceType getDeviceType() {
		return deviceType;
	}

	/**
	 * @param deviceType the deviceType to set
	 */
	public void setDeviceType(DeviceType deviceType) {
		this.deviceType = deviceType;
	}


}
